package cn.jx.asc.service.impl;

import cn.jx.asc.pojo.entity.Role;
import cn.jx.asc.dao.mapper.RoleMapper;
import cn.jx.asc.pojo.vo.RoleVO;
import cn.jx.asc.service.RoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lhg
 * @since 2021-06-07
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Transactional(propagation = Propagation.SUPPORTS ,rollbackFor=Exception.class)
    @Override
    public RoleVO queryRoleByUserId(String userId) {
        return roleMapper.queryRoleByUserId( userId );
    }

    @Transactional(propagation = Propagation.SUPPORTS ,rollbackFor=Exception.class)
    @Override
    public String queryRoleKeyById(String roleId) {
        return roleMapper.selectById(roleId).getKeyword();
    }
}
